package com.pay.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pay.common.base.BaseService;
import com.pay.common.support.Convert;
import com.pay.mapper.auto.PayAccountDetailMapper;
import com.pay.model.auto.PayAccountDetail;
import com.pay.model.auto.PayAccountDetailExample;
import com.pay.model.custom.Tablepar;
import com.pay.util.SnowflakeIdWorker;

/**
 * 支付账户详情Service
 *
 * @author fuce
 * @Title: PayAccountDetailService.java 
 * @Package com.pay.service 
 * @email 87766867@qq.com
 * @date 2019-06-24 10:54:26  
 */
@Service
public class PayAccountDetailService implements BaseService<PayAccountDetail, PayAccountDetailExample> {
    @Autowired
    private PayAccountDetailMapper payAccountDetailMapper;

    /**
     * 分页查询
     *
     * @param tablepar
     * @param name
     * @return
     */
    public PageInfo<PayAccountDetail> list(Tablepar tablepar, String name) {
        PayAccountDetailExample testExample = new PayAccountDetailExample();
        testExample.setOrderByClause("id ASC");

        PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
        List<PayAccountDetail> list = payAccountDetailMapper.selectByExample(testExample);
        PageInfo<PayAccountDetail> pageInfo = new PageInfo<PayAccountDetail>(list);
        return pageInfo;
    }


    @Override
    public int deleteByPrimaryKey(String id) {
        return payAccountDetailMapper.deleteByPrimaryKey(id);
    }

    /**
     * 添加
     */
    @Override
    public int insertSelective(PayAccountDetail record) {
        //添加雪花主键id
        record.setId(SnowflakeIdWorker.getUUID());
        return payAccountDetailMapper.insertSelective(record);
    }

    @Override
    public PayAccountDetail selectByPrimaryKey(String id) {
        return payAccountDetailMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(PayAccountDetail record) {
        return payAccountDetailMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByExampleSelective(PayAccountDetail record, PayAccountDetailExample example) {

        return 0;
    }

    @Override
    public int updateByExample(PayAccountDetail record, PayAccountDetailExample example) {

        return payAccountDetailMapper.updateByExample(record, example);
    }

    @Override
    public List<PayAccountDetail> selectByExample(PayAccountDetailExample example) {

        return payAccountDetailMapper.selectByExample(example);
    }


    @Override
    public long countByExample(PayAccountDetailExample example) {

        return payAccountDetailMapper.countByExample(example);
    }


    @Override
    public int deleteByExample(PayAccountDetailExample example) {

        return payAccountDetailMapper.deleteByExample(example);
    }

    /**
     * 检查name
     *
     * @param payAccountDetail
     * @return
     */
    public int checkNameUnique(PayAccountDetail payAccountDetail) {
        PayAccountDetailExample example = new PayAccountDetailExample();
        List<PayAccountDetail> list = payAccountDetailMapper.selectByExample(example);
        return list.size();
    }


}
